Repository navigation
setup.py: check SHA-256 of the downloaded MuPDF tarball - #5332
Open
owen-alderson wants to merge 1 commit into
Open
owen-alderson wants to merge 1 commit into
owen-alderson wants to merge 1 commit into
Conversation
The default MuPDF .tar.gz was downloaded without any integrity check. Hard-code its SHA-256 from https://mupdf.com/releases next to version_mupdf and check it after downloading, and when reusing a previously downloaded file. Custom locations from PYMUPDF_SETUP_MUPDF_TGZ are not checked. Fixes pymupdf#3463. Assisted-by: Claude Code:claude-opus-5-5
Author
|
I have read the CLA Document and I hereby sign the CLA |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3463.
The default MuPDF source tarball (
mupdf-{version_mupdf}-source.tar.gz) was downloaded and built without any integrity check, so a modified tarball, from a compromised server or a corrupted download, would be built silently.This adds
version_mupdf_sha256next toversion_mupdf, set to the SHA-256 that https://mupdf.com/releases lists formupdf-1.28.6-source.tar.gz.get_mupdf_internal()checks it:Custom locations set with
PYMUPDF_SETUP_MUPDF_TGZ(URL, git or local path) are not checked, so existing workflows are unchanged. The hash needs updating together withversion_mupdfon each MuPDF upgrade.Testing (Python 3.12, macOS), calling
get_mupdf_internal('tgz')directly:SHA-256 mismatch ... expected 000…, got dc85000640a4…without being renamed into place.I did not run a full source build.
AI assistance: written with Claude Code (claude-opus-5-5); I reviewed the change and the test results.